package chapter_7;

import java.io.FileReader;
import java.io.FileWriter;
import java.util.Properties;

public class Test15 {
    public static void main(String[] args) throws Exception{
//        Properties p = new Properties();
//        p.setProperty("name","学生管理系统");
//        p.setProperty("port","8080");
//        p.setProperty("url","127.0.0.1");
//        p.setProperty("database","mysql");
////        System.out.println(p.getProperty("database"));
//        for (String s : p.stringPropertyNames()) {
//            System.out.println("key="+s +"  value=" +p.getProperty(s));
//        }
//       p.store(new FileWriter("D:\\config.properties"),"配置文件");

        Properties p = new Properties();
        p.load(new FileReader("D:\\config.properties"));
        System.out.println(p.getProperty("name"));

    }
}
